chcp 65001
@echo off
echo ===================================
echo    语音助手服务一键启动脚本
echo ===================================
echo.

REM 设置窗口标题
title 语音助手服务启动控制台

REM 获取当前目录作为根目录
set ROOT_DIR=%~dp0

REM 启动Ollama服务
echo [1/5] 正在启动Ollama大模型服务...
start "Ollama LLM服务" cmd /k "ollama serve"
echo Ollama服务启动中，请等待...
timeout /t 5 /nobreak > nul

REM 启动CosyVoice服务
echo [2/5] 正在启动CosyVoice语音合成服务...
start "CosyVoice TTS服务" cmd /k "cd /d %ROOT_DIR%CosyVoice && call conda activate cosyvoice && python cosyvoice_api.py"
echo CosyVoice服务启动中，请等待...
timeout /t 5 /nobreak > nul

REM 启动SenseVoice服务
echo [3/5] 正在启动SenseVoice语音识别服务...
start "SenseVoice ASR服务" cmd /k "cd /d %ROOT_DIR%SenseVoice-main && python stream_api.py"
echo SenseVoice服务启动中，请等待...
timeout /t 5 /nobreak > nul

REM 启动前端Vue应用
echo [4/4] 正在启动AIVoice-vue前端...
start "AIVoice-vue前端" cmd /k "cd /d %ROOT_DIR%AIVoice-vue && npm run dev"

echo.
echo ===================================
echo    所有服务已启动!
echo.
echo    Ollama LLM服务: http://localhost:11434
echo    CosyVoice TTS服务: http://localhost:8001
echo    SenseVoice ASR服务: http://localhost:9001
echo    AIVoice 后端: http://localhost:8081
echo    AIVoice-vue前端: http://localhost:5173
echo.
echo    注意: 首次运行Ollama可能需要下载模型
echo    可使用命令: ollama pull qwen2.5:7b
echo.
echo    按任意键退出此控制台(各服务将在独立窗口中继续运行)
echo ===================================

pause > nul 